<?php /* SVN: $Id: admin_index.ctp 2897 2010-09-02 11:26:34Z beautlin_108ac10 $ */ ?>
<div class="projects index js-response">
     <div class="flow-left">
 <ul class="chart-list clearfix">
  <li>
    <span class="idea"><a href="../admin/projects/add/" title="<?PHP if(Configure::read('Project.is_enable_idea')){ $new_link = __l("Add Idea");} else { $new_link = __l("Add Project"); } echo $new_link; ?>"><?PHP echo $new_link; ?></a></span>
    <div class="pay-left"><div class="pay-right"><span class="pay"><?php echo $this->Html->link(sprintf(__l('Listing Fee Paid (%s)'),$this->Html->cInt($paid_projects,false)), array('controller' => 'projects', 'action' => 'index', 'transaction_type_id' => ConstTransactionTypes::Project), array('title' => sprintf(__l('Listing Fee Paid (%s)'),$this->Html->cInt($paid_projects,false))));?></span></div></div>
    <span id="tip" class="helptip js-helptip" title="<?php echo __l("If idea enabled, all projects considered as idea. If not, considered as project."); ?>"></span>
    <span id="tip1" class="helptip js-helptip helptip1" title="<?php echo __l("If listing fee added in settings, all projects can be added only when project owner pay the fee."); ?>"></span>
    </li>
  <li class="pending-left">
    <span class="pending"><?php echo $this->Html->link(sprintf(__l('Pending(%s)'),$this->Html->cInt($pending_project_count,false)), array('controller' => 'projects', 'action' => 'index', 'project_status_id' => ConstProjectStatus::Pending), array( 'title' => sprintf(__l('Pending(%s)'),$this->Html->cInt($pending_project_count,false))));?></span>
    <div class="vote-left"><div class="vote-right"><span class="voting"><?php echo $this->Html->link(sprintf(__l('Open for Idea(%s)'),$this->Html->cInt($open_for_idea,false)), array('controller' => 'projects', 'action' => 'index', 'project_status_id' => ConstProjectStatus::OpenForIdea), array('title' => sprintf(__l('Open for Idea(%s)'),$this->Html->cInt($open_for_idea,false))));?></span></div></div>
    <span id="tip2" class="helptip js-helptip" title="<?php echo __l("If auto approve enabled in settings, all projects automatically approved."); ?>"></span>
    <span id="tip3" class="helptip js-helptip helptip2" title="<?php echo __l("If idea is enabled, initially all the project will be considered as an idea. Based on votes, it will be moved as project by administrator."); ?>"></span>
  </li>
  <li class="move-tofund">
    <span class="funding"><?php echo $this->Html->link(sprintf(__l('Open for funding(%s)'),$this->Html->cInt($opened_project_count,false)), array('controller' => 'projects', 'action' => 'index', 'project_status_id' => ConstProjectStatus::OpenForFunding), array('title' => sprintf(__l('Open for funding(%s)'),$this->Html->cInt($opened_project_count,false))));?></span>
    <span id="tip4" class="helptip js-helptip" title="<?php echo __l("Projects in funding status."); ?>"></span>
       <span class="long-arrow <?php echo (!Configure::read('Project.is_enable_threshold_limit')) ?'long-arrow-reserve':''; ?>">arrow</span>
         <ul>
          <li class="cancell-list"><span class="cancelch">
			   <?php echo $this->Html->link(sprintf(__l('Cancelled(%s)'),$this->Html->cInt($canceled_project_count,false)), array('controller' => 'projects', 'action' => 'index', 'project_status_id' => ConstProjectStatus::ProjectCancelled), array('title' => sprintf(__l('Cancelled(%s)'),$this->Html->cInt($canceled_project_count,false))));?>
		</span>
         <span id="tip5" class="helptip js-helptip" title="<?php echo __l("Amount authorization will be canceled"); ?>"></span>
          </li>
          <li class="expire-list">
           <span class="expire">
		   	  <?php echo $this->Html->link(sprintf(__l('Expired(%s)'),$this->Html->cInt($expired_project_count,false)), array('controller' => 'projects', 'action' => 'index', 'project_status_id' => ConstProjectStatus::FundingExpired), array('title' => sprintf(__l('Expired(%s)'),$this->Html->cInt($expired_project_count,false))));?>
			</span>
             <span id="tip6" class="helptip js-helptip" title="<?php echo __l("If needed amount not reached with in the project end date, projects moves to expired and preapproved authorization will be canceled."); ?>"></span>
          </li>
         </ul>
  </li>
  <?PHP if(Configure::read('Project.is_enable_threshold_limit')) { ?>
   <li class="reverse-list"><div class="reserve-inner">
    <span class="reserve">
  		<?php echo $this->Html->link(sprintf(__l('Reserve Amount Reached(%s)'),$this->Html->cInt($reserve_amount_reached,false)), array('controller' => 'projects', 'action' => 'index', 'project_status_id' => ConstProjectStatus::ReserveAmountReached), array('title' => sprintf(__l('Reserve Amount Reached(%s)'),$this->Html->cInt($reserve_amount_reached,false))));?>
	</span></div>
     <span id="tip7" class="helptip js-helptip" title="<?php echo __l("Once the total pledges reaches this amount, the amount will be captured and moved to project owner."); ?>"></span>
   </li>
   <?PHP } ?>
  <li class="reached-list">
  <span class="goal">
      <?php echo $this->Html->link(sprintf(__l('Goal Reached(%s)'),$this->Html->cInt($goal_reached,false)), array('controller' => 'projects', 'action' => 'index', 'project_status_id' => ConstProjectStatus::GoalReached), array('title' => sprintf(__l('Goal Reached(%s)'),$this->Html->cInt($goal_reached,false))));?>
  </span>
   <span id="tip8" class="helptip js-helptip" title="<?php echo __l("All funding's captured  and needed amount moves to project owner paypal account and commission amount moves to site admin paypal account. And if over funding allowed, user's can fund more than needed amount and every fund will be captured after goal reached."); ?>"></span>
 </li>
   <li class="reached-list"><span class="close1">
   		  <?php echo $this->Html->link(sprintf(__l('Closed(%s)'),$this->Html->cInt($closed_project_count,false)), array('controller' => 'projects', 'action' => 'index', 'project_status_id' => ConstProjectStatus::FundingClosed), array('title' => sprintf(__l('Closed(%s)'),$this->Html->cInt($closed_project_count,false))));?>
		</span>
	   <span id="tip9" class="helptip js-helptip" title="<?php echo __l("All funding's captured and needed amount moves to project owner paypal account and commission amount moves to site admin paypal account."); ?>"></span>
   </li>
 </ul>
</div>
	<ul class="filter-list-block clearfix">
        <li <?php if (!empty($this->request->params['named']['filter_id']) && $this->request->params['named']['filter_id'] == ConstMoreAction::Suspend) { echo 'class="active"';} ?>><span class="lightblue-block" title="<?php echo __l('Suspended'); ?>"><?php echo $this->Html->link($this->Html->cInt($suspended,false).'<span>' .__l('Suspended'). '</span>', array('controller'=>'projects','action'=>'index','filter_id' => ConstMoreAction::Suspend), array('escape' => false));?></span> </li>
        <li <?php if (!empty($this->request->params['named']['filter_id']) && $this->request->params['named']['filter_id'] == ConstMoreAction::Flagged) { echo 'class="active"';} ?>><span class="red-block" title="<?php echo __l('Flagged'); ?>"><?php echo $this->Html->link($this->Html->cInt($system_flagged,false).'<span>' .__l('Flagged'). '</span>', array('controller'=>'projects','action'=>'index','filter_id' => ConstMoreAction::Flagged), array('escape' => false));?></span> </li>
 		<li <?php if (empty($this->request->params['named']['filter_id']) && empty($this->request->params['named']['project_status_id'])) { echo 'class="active"';} ?>><span class="import-block" title="<?php echo __l('Total Projects'); ?>"><?php echo $this->Html->link($this->Html->cInt($total_projects,false).'<span>' .__l('Total'). '</span>', array('controller'=>'projects','action'=>'index'), array('escape' => false));?></span> </li>
	</ul>
<div class="page-count-block clearfix">
	    <div class="grid_left">
	      <?php echo $this->element('paging_counter'); ?>
		</div>
		<div class="grid_left">
        <?php echo $this->Form->create('Project', array('type' => 'get', 'class' => 'normal search-form clearfix', 'action'=>'index')); ?>
            <div class="not-required grid_left">
    			<?php echo $this->Form->input('project_status_id', array('empty' => __l('All'))); ?>
            </div>
            <?php echo $this->Form->input('q', array('label' => __l('Keyword'))); ?>
    			<?php echo $this->Form->submit(__l('Search'));?>
	      <?php echo $this->Form->end(); ?>
		</div>
        <div class="add-block grid_right">
		<?php if(Configure::read('Project.is_enable_idea')) :?>
		<?php $title =  __l('Add Idea'); ?>
		<?php else: ?>
		<?php $title =  __l('Add Project'); ?>
		<?php endif; ?>
	        <?php echo $this->Html->link(__l('Add'),array('controller'=>'projects', 'action'=>'add'),array('class' => 'add', 'title' => $title));?>
      </div>
  </div>
<?php
 echo $this->Form->create('Project' , array('class' => 'normal clearfix','action' => 'update')); ?>
<?php echo $this->Form->input('r', array('type' => 'hidden', 'value' => $this->request->url)); ?>

<table class="list" id="js-expand-table">
    <tr class="js-even">
       	<th rowspan="2"><?php echo __l('Select'); ?></th>
        <th rowspan="2" class="dl"><div class="js-pagination"><?php echo $this->Paginator->sort(__l('Name'),'name');?></div></th>
        <th rowspan="2"><div class="js-pagination"><?php echo $this->Paginator->sort(__l('Posted By'),'User.username');?></div></th>
        <?PHP if(Configure::read('Project.is_enable_threshold_limit')) { ?>
          <th colspan="3">
        <?PHP } else{  ?>
        <th colspan="2">
        <?PHP } ?>
        <?php echo __l('Amount') ;?></th>
        <th colspan="2"><?php echo __l('Site Fee') ;?></th>
        <th rowspan="2">
        <div class="js-pagination">
        <?php echo __l('Funding Date'); ?>
		<div><?php echo $this->Paginator->sort(__l('Start'), 'project_funding_start_date');?></div>/<div class="js-pagination"><?php echo $this->Paginator->sort(__l('End'), 'project_funding_end_date');?></div>
        </div>
        </th>
        <th rowspan="2"><div class="js-pagination"><?php echo $this->Paginator->sort(__l('Funding Goal Reached Date'), 'project_fund_goal_reached_date');?></div></th>
        <?php if (Configure::read('Project.is_enable_idea')) : ?>
        <th colspan="3"><?php echo __l('Votings') ;?></th>
        <?php endif; ?>
		<th rowspan="2"><div class="js-pagination"><?php echo $this->Paginator->sort(__l('Posted On'),'created');?></div></th>

    </tr>
	<tr class="js-even">
		<th><div class="js-pagination"><?php echo $this->Paginator->sort(__l('Needed'),'needed_amount').' ('.Configure::read('site.currency').')';?></div></th>
        <th><div class="js-pagination"><?php echo $this->Paginator->sort(__l('Collected'),'collected_amount').' ('.Configure::read('site.currency').')';?></div></th>
        <?PHP if(Configure::read('Project.is_enable_threshold_limit')) { ?>
		<th><div class="js-pagination"><?php echo $this->Paginator->sort(__l('Reserve amount'),'reserve_amount').' ('.Configure::read('site.currency').')';?></div></th>
        <?PHP } ?>
        <th><div class="js-pagination"><?php echo $this->Paginator->sort(__l('Listing Fee'),'fee_amount').' ('.Configure::read('site.currency').')';?></div></th>
		<th><div class="js-pagination"><?php echo $this->Paginator->sort(__l('Commission'),'commission_amount').' ('.Configure::read('site.currency').')';?></div></th>
        <?php if (Configure::read('Project.is_enable_idea')) : ?>
		<th><div class="js-pagination"><?php echo $this->Paginator->sort(__l('Total votings'),'total_ratings');?></div></th>
        <th><div class="js-pagination"><?php echo $this->Paginator->sort(__l('Voting count'), 'project_rating_count');?></div></th>
		<th><div class="js-pagination"> <?php echo __l('Average');?> </div></th>
        <?php endif; ?>
	</tr>
<?php
if (!empty($projects)):

$i = 0;
foreach ($projects as $project):
	$class = null;

		$class = ' class="altrow expand-row js-odd"';
	
	if($project['Project']['is_active']):
		$status_class = 'js-checkbox-active';
		$td_class = 'admin-status-1';
		$class = ' class="altrow expand-row js-odd active-record"';
	else:
		$status_class = 'js-checkbox-inactive';
		$td_class = 'admin-status-0';
		$class = ' class="altrow expand-row js-odd inactive-record"';
	endif;
	if($project['Project']['admin_suspend']):
		$status_class.= ' js-checkbox-suspended';
	else:
		$status_class.= ' js-checkbox-unsuspended';
	endif;
	if($project['Project']['is_system_flagged']):
		$status_class.= ' js-checkbox-flagged';
	else:
		$status_class.= ' js-checkbox-unflagged';
	endif;
?>
	<tr<?php echo $class;?>>
        <td>
    <div class="arrow"></div>
        <?php echo $this->Form->input('Project.'.$project['Project']['id'].'.id', array('type' => 'checkbox', 'id' => "admin_checkbox_".$project['Project']['id'], 'label' => false, 'class' => $status_class.' js-checkbox-list')); ?></td>

		<td class="dl">		
                      <div class="clearfix">
                         <span title="<?php echo $this->Html->cText($project['ProjectStatus']['name'],false); ?>" class="project-atatus-info project-status-<?php echo $project['Project']['project_status_id'];?>">
						 <?php echo $this->Html->cText($project['ProjectStatus']['name']); ?>
                         </span>

            <?php echo $this->Html->cText($this->Html->truncate($project['Project']['name'],90, array('ending' => '...')),false);?>                         
                       
						        <?php
				if(!empty($project['Project']['admin_suspend'])):
					echo '<span class="suspended round-5">'.__l('Admin Suspended').'</span>';
				endif;
					if(!empty($project['ProjectFlag'])):
						echo '<span class="flagged round-5">'.__l('Flagged').'</span>';
					endif;
					if($project['Project']['is_system_flagged']):
						echo '<span class="system-flagged round-5">'.__l('System Flagged').'</span>';
					endif;
					if(!empty($project['Project']['project_flag_count'])) :
						echo '<span class="user-flagged round-5">'.__l('User Flagged').'</span>';
					endif;
			?>	
						</div>
            	</td>
		<td><?php echo $this->Html->cText($project['User']['username']);?></td>
		<td><?php echo $this->Html->cCurrency($project['Project']['needed_amount']);?></td>
		<td>
		<?php $collected_percentage = ($project['Project']['collected_percentage']) ? $project['Project']['collected_percentage'] : 0; ?>
		<div class="progress-block round-5">
			<p class="progress-bar progress-bar-amount round-5" title = '<?php echo $this->Html->cFloat($collected_percentage,false).'%'; ?>'>
				<span class="round-5" style="width:<?php echo ($collected_percentage > 100) ? '100%' : $collected_percentage.'%'; ?>;" title = "<?php echo $this->Html->cFloat($collected_percentage,false).'%'; ?>">
				</span>
			</p>
			<p class="clearfix">
			<span class="needed-price"><?php echo Configure::read('site.currency').$this->Html->cCurrency($project['Project']['collected_amount']);?> / <?php echo Configure::read('site.currency').$this->Html->cCurrency($project['Project']['needed_amount']);?></span>
            </p>
		</div>
						
		</td>
		<?PHP if(Configure::read('Project.is_enable_threshold_limit')) { ?>
		<td><?php echo $this->Html->cCurrency($project['Project']['reserve_amount']);?></td>
		<?PHP } ?>
		<td class="site-amount"><?php echo $this->Html->cCurrency($project['Project']['fee_amount']);?></td>
		<td class="commission-amount"><?php echo $this->Html->cCurrency($project['Project']['commission_amount']);?></td>
		<td>
		<?php if(empty($project['Project']['project_funding_start_date']) || $project['Project']['project_funding_start_date'] == '0000-00-00')   {
			echo '-';
		}  else {?>
			<div class="clearfix">
                       <div class="progress-block clearfix">
                       <?php 
							$project_progress_precentage = 0;
							if(strtotime($project['Project']['project_funding_start_date']) < strtotime(date('Y-m-d H:i:s'))) {
								if($project['Project']['project_funding_end_date'] !== 	NULL) {
									$days_till_now = (strtotime(date("Y-m-d")) - strtotime(date($project['Project']['project_funding_start_date']))) / (60 * 60 * 24);
									$total_days = (strtotime(date($project['Project']['project_funding_end_date'])) - strtotime(date($project['Project']['project_funding_start_date']))) / (60 * 60 * 24);
                                     if($total_days)
                                     {
                                        $project_progress_precentage = round((($days_till_now/$total_days) * 100));
                                     }
                                     else{
                                        $project_progress_precentage = round((($days_till_now) * 100));
                                    }
                                    
									if($project_progress_precentage > 100)
									{
										$project_progress_precentage = 100;
									}
								} else {
									$project_progress_precentage = 100;
								}
							}
						?>		
						<?php if($project['Project']['project_funding_end_date'])?>			
                        <p class="progress-bar round-5">
                           <span class="round-5 <?php echo ($project['Project']['project_funding_end_date'] === NULL)? ' any-time-deal-progress': 'progress-status '; ?>" style="width:<?php echo $project_progress_precentage; ?>%" title="<?php echo ($project['Project']['project_funding_end_date'] === NULL)? __l(''): $project_progress_precentage.'%'; ?>">&nbsp;</span>
                        </p>
                        <p class="progress-value clearfix"><span class="progress-from"><?php echo $this->Html->cDateTimeHighlight($project['Project']['project_funding_start_date']);?></span>&nbsp;/&nbsp;<span class="progress-to"><?php echo (!is_null($project['Project']['project_funding_end_date']))? $this->Html->cDateTimeHighlight($project['Project']['project_funding_end_date']): ' - ';?></span></p>
                       </div>
                     </div>			
					 <?php } ?>
        </td>
		<td><?php echo ($project['Project']['project_fund_goal_reached_date'])?$this->Html->cDateTime($project['Project']['project_fund_goal_reached_date']):' ';?></td>

        <?php if (Configure::read('Project.is_enable_idea')) : ?>
            <td><?php echo $this->Html->cFloat($project['Project']['total_ratings']);?></td>
            <td><?php echo $this->Html->link($this->Html->cInt($project['Project']['project_rating_count']), array('controller'=> 'project_ratings', 'action'=>'index', 'project_id'=> $project['Project']['id']), array('escape' => false)); ?></td>
            <td><?php
			$rating= $project['Project']['project_rating_count']?$project['Project']['total_ratings']/$project['Project']['project_rating_count']:$project['Project']['project_rating_count'];
			echo $this->Html->cFloat($rating);?></td>
		<?php endif; ?>



	
		<td><?php echo $this->Html->cDateTimeHighlight($project['Project']['created']);?></td>
	</tr>
<!-- hide-->
	<tr class="hide" style="display: none;">
        <td class="action-block dl" colspan="16">
            <div class="action-info-block clearfix">
                
                <div class="grid_4">
                <h3> <?php echo __l('Action'); ?> </h3>                
                <ul class="clearfix">
                        
			<li><?php echo $this->Html->link(__l('Payment Detail'), array('controller' => 'projects', 'action' => 'payment',  $project['Project']['id']),array('class' => 'widthdraw', 'title' => __l('Payment Detail'))); ?></li>
                        
			<?php if($project['Project']['project_status_id'] == ConstProjectStatus::Pending && Configure::read('Project.is_enable_idea') ): ?>
				<li><?php echo $this->Html->link(__l('Move for voting'), array('action'=>'admin_open_funding', $project['Project']['id'],'type'=>'vote'), array('class' => 'approve js-delete', 'title' => __l('Move for voting'))); ?></li>
			<?php endif; ?>

		<?php if($project['Project']['project_status_id'] == ConstProjectStatus::Pending || $project['Project']['project_status_id'] == ConstProjectStatus::OpenForIdea): ?>
			<li><?php echo $this->Html->link(__l('Move for funding'), array('action'=>'admin_open_funding', $project['Project']['id']), array('class' => 'widthdraw js-delete', 'title' => __l('Move for funding'))); ?></li>
			<?php endif; ?>

	
        <li><?php echo $this->Html->link(__l('Edit'), array('action' => 'edit', $project['Project']['id']), array('class' => 'edit js-edit', 'title' => __l('Edit')));?></li>

        <?php if($project['Project']['project_status_id'] == ConstProjectStatus::OpenForFunding && $project['Project']['admin_suspend']): ?>
		<li><?php echo $this->Html->link(__l('Manually Capture Fund'), array('action' => 'capture_fund', $project['Project']['id']), array('class' => 'js-delete capture', 'title' => __l('Manually Capture Fund')));?></li>
		<?php endif; ?>

        <li><?php echo $this->Html->link(__l('Delete'), array('action' => 'delete', $project['Project']['id']), array('class' => 'delete js-delete', 'title' => __l('Delete')));?></li>
        <?php if($project['Project']['is_system_flagged']):?>
            <li>	<?php echo $this->Html->link(__l('Clear flag'), array('action' => 'admin_update_stats', $project['Project']['id'], 'flag' => 'deactivate'), array('class' => 'clear-flag js-delete', 'title' => __l('Clear flag')));?>
            </li>
        <?php else:?>
			<?php if($project['Project']['project_status_id'] == ConstProjectStatus::OpenForFunding || $project['Project']['project_status_id'] == ConstProjectStatus::Pending || $project['Project']['project_status_id'] == ConstProjectStatus::ProjectCancelled || $project['Project']['project_status_id'] == ConstProjectStatus::OpenForIdea): ?>
				 <li>	<?php echo $this->Html->link(__l('Flag'), array('action' => 'admin_update_stats', $project['Project']['id'], 'flag' => 'active'), array('class' => 'flag js-delete', 'title' => __l('Flag')));?>
				</li>
			<?php endif; ?>
        <?php endif;?>
        <?php if($project['Project']['admin_suspend']):?>
			<li><?php echo $this->Html->link(__l('Unsuspend'), array('action' => 'admin_update_stats', $project['Project']['id'], 'flag' => 'unsuspend'), array('class' => 'unsuspend js-delete', 'title' => __l('Unsuspend')));?>
			</li>
		<?php else:?>
			<?php if($project['Project']['project_status_id'] == ConstProjectStatus::OpenForFunding || $project['Project']['project_status_id'] == ConstProjectStatus::Pending || $project['Project']['project_status_id'] == ConstProjectStatus::ProjectCancelled || $project['Project']['project_status_id'] == ConstProjectStatus::OpenForIdea): ?>
				<li><?php echo $this->Html->link(__l('Suspend'), array('action' => 'admin_update_stats', $project['Project']['id'], 'flag' => 'suspend'), array('class' => 'suspend js-delete', 'title' => __l('Suspend')));?>
				</li>
			<?php endif;?>
		<?php endif;?>
			<?php if($project['Project']['project_status_id'] == ConstProjectStatus::OpenForFunding || $project['Project']['project_status_id'] == ConstProjectStatus::Pending): ?>
			<li><?php echo $this->Html->link(__l('Cancel'), array('action'=>'admin_cancel', $project['Project']['id']), array('class' => 'cancel js-delete', 'title' => __l('Cancel'))); ?></li>
			<?php endif; ?>
     		 </ul>
                </div>
                
                <div class="action-right-block grid_19 clearfix">
                     <div class="grid_15 action-mid">
                     <h3> <?php echo __l('Stats'); ?> </h3>
                    <dl class="clearfix">
				        <?php if (Configure::read('Project.is_project_comment_enabled')) : ?>
                            <dt>
                                <?php echo __l('Comments'); ?>
                            </dt>
                            <dd>
                            <?php echo $this->Html->link($this->Html->cInt($project['Project']['project_comment_count']), array('controller'=> 'project_comments', 'action'=>'index', 'project_id'=> $project['Project']['id']), array('escape' => false)); ?>
                            </dd>
                        <?php endif; ?> 
                    </dl> 

                    <dl class="clearfix">
                            <dt>
                                <?php echo __l('Project Updates'); ?>
                            </dt>
                            <dd>
<?php echo $this->Html->link($this->Html->cInt($project['Project']['blog_count']), array('controller'=> 'blogs', 'action'=>'index', 'project_id'=> $project['Project']['id']), array('escape' => false)); ?>                            
                            </dd>
                    </dl> 

                    <dl class="clearfix">
				        <?php if(Configure::read('Project.is_project_flag_enabled')): ?>
                            <dt>
                                <?php echo __l('Project Flags'); ?>
                            </dt>
                            <dd>
                            <?php echo $this->Html->link($this->Html->cInt($project['Project']['project_flag_count']), array('controller'=> 'project_flags', 'action'=>'index', 'project_id'=> $project['Project']['id']), array('escape' => false)); ?>
                            </dd>
                        <?php endif; ?> 
                    </dl> 

                    <dl class="clearfix">
                            <dt>
                                <?php echo __l('Normal view count'); ?>
                            </dt>
                            <dd>
<?php echo $this->Html->link($this->Html->cInt($project['Project']['project_view_count']), array('controller'=> 'project_views', 'action'=>'index', 'project_id'=> $project['Project']['id'],'type'=>'normal'), array('escape' => false)); ?>                           
                            </dd>
                    </dl> 

                    <dl class="clearfix">
                            <dt>
                                <?php echo __l('Embed view count'); ?>
                            </dt>
                            <dd>
<?php echo $this->Html->link($this->Html->cInt($project['Project']['embed_view_count']), array('controller'=> 'project_views', 'action'=>'index', 'project_id'=> $project['Project']['id'],'type'=>'embed'), array('escape' => false)); ?>                          
                            </dd>
                    </dl> 

					<dl class="clearfix">
				            <dt>
                                <?php echo __l('Backers'); ?>
                            </dt>
                            <dd>
                            <?php echo $this->Html->link($this->Html->cInt($project['Project']['project_fund_count']), array('controller'=> 'project_funds', 'action'=>'index', 'type' => 'backed', 'project_id'=> $project['Project']['id']), array('escape' => false)); ?>
                            </dd>
                    </dl> 
		
                    <dl class="clearfix">
				        <?php  if (Configure::read('Project.is_project_follower_enabled')): ?>
                            <dt>
                                <?php echo __l('Followers'); ?>
                            </dt>
                            <dd>
                            <?php echo $this->Html->link($this->Html->cInt($project['Project']['project_follower_count']), array('controller'=> 'project_followers', 'action'=>'index', 'project_id'=> $project['Project']['id']), array('escape' => false)); ?>
                            </dd>
                        <?php endif; ?> 
                    </dl> 

                        </div>

<div class="grid_6">
     <h3> <?php echo __l('Image'); ?> </h3>
<?php echo $this->Html->link($this->Html->showImage('Project', $project['Attachment'], array('dimension' => 'big_thumb', 'alt' => sprintf(__l('[Image: %s]'), $this->Html->cText($project['Project']['name'], false)), 'title' => $this->Html->cText($project['Project']['name'], false)),array('aspect_ratio'=>1)), array('controller' => 'projects', 'action' => 'view',  $project['Project']['slug'], 'admin' => false), array('escape' => false)); ?>
 <div class="ip-block">
 <?php if(!empty($project['Ip']['ip'])): ?>
                            <?php echo  $this->Html->link($project['Ip']['ip'], array('controller' => 'users', 'action' => 'whois', $project['Ip']['ip'], 'admin' => false), array('target' => '_blank', 'title' => 'whois '.$this->Html->cText($project['Ip']['host'],false), 'escape' => false)); ?>
							<p>
							<?php
                            if(!empty($project['Ip']['Country'])):
                                ?>
                                <span class="flags flag-<?php echo strtolower($project['Ip']['Country']['iso2']); ?>" title ="<?php echo $project['Ip']['Country']['name']; ?>">
									<?php echo $project['Ip']['Country']['name']; ?>
								</span>
                                <?php
                            endif;
							 if(!empty($project['Ip']['City'])):
                            ?>
                            <span> 	<?php echo $project['Ip']['City']['name']; ?>    </span>
                            <?php endif; ?>
                            </p>
                        <?php else: ?>
							<?php echo __l('N/A'); ?>
						<?php endif; ?>
                        </div>
						</div>
                </div>
                
            </div>
        </td>
    </tr>
<?php
    endforeach;
else:
?>
	<tr class="js-even">
		<td colspan="22" class="notice"><?php echo __l('No Projects available');?></td>
	</tr>
<?php
endif;
?>
</table>


<?php if (!empty($projects)) {?>
    	<div class="clearfix">
	<div class="admin-select-block grid_left">
		<?php echo __l('Select:'); ?>
		<?php echo $this->Html->link(__l('All'), '#', array('class' => 'js-admin-select-all', 'title' => __l('All'))); ?>
		<?php echo $this->Html->link(__l('None'), '#', array('class' => 'js-admin-select-none', 'title' => __l('None'))); ?>
		<?php echo $this->Html->link(__l('Inactive'), '#', array('class' => 'js-admin-select-pending', 'title' => __l('Inactive'))); ?>
		<?php echo $this->Html->link(__l('Active'), '#', array('class' => 'js-admin-select-approved', 'title' => __l('Active'))); ?>
		<?php echo $this->Html->link(__l('Suspended'), '#', array('class' => 'js-admin-select-suspended', 'title' => __l('Suspended'))); ?>
		<?php echo $this->Html->link(__l('Flagged'), '#', array('class' => 'js-admin-select-flagged', 'title' => __l('Flagged'))); ?>
	</div>
	<div class="admin-checkbox-button grid_4 grid_left"><?php echo $this->Form->input('more_action_id', array('class' => 'js-admin-index-autosubmit', 'label' => false, 'empty' => __l('-- More actions --'))); ?></div>

<div class="js-pagination grid_right">
 <?php echo $this->element('paging_links'); ?>
 </div>  
  
	
    <div class="hide">
	    <?php echo $this->Form->submit('Submit'); ?>
    </div>
<?php }?>
</div>
    <?php echo $this->Form->end(); ?>
    </div>